package com.xuchaotong.entity;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author EASON.TONG
 * @date 2021/04/23
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ItemLabelDTO implements Serializable {

    private Long id;
    private String label;
    private LocalDateTime createTime;

    public static Map<String, ItemLabelDTO> build() {
        Map<String, ItemLabelDTO> map = new HashMap<>(16);
        map.put("1", ItemLabelDTO.builder().id(1L).label("EASON").build());
        map.put("2", ItemLabelDTO.builder().id(2L).label("JACK").build());
        map.put("3", ItemLabelDTO.builder().id(3L).label("JENNY").build());
        map.put("4", ItemLabelDTO.builder().id(4L).label("TIGER").build());
        map.put("5", ItemLabelDTO.builder().label("LISA").build());
        map.put("6", ItemLabelDTO.builder().label("PANDER").build());

        return map;
    }


    public static List<ItemLabelDTO> buildList() {
        List<ItemLabelDTO> list = new ArrayList<>();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime dateTime = LocalDateTime.parse("2021-02-17 15:33:30", formatter);
        LocalDateTime dateTime1 = LocalDateTime.parse("2021-03-18 15:33:30", formatter);
        LocalDateTime dateTime2 = LocalDateTime.parse("2021-01-17 15:33:30", formatter);
        LocalDateTime dateTime3 = LocalDateTime.parse("2021-11-13 15:33:30", formatter);

        list.add(ItemLabelDTO.builder().id(1L).label("210513170242515001").createTime(dateTime).build());
        list.add(ItemLabelDTO.builder().id(2L).label("210513170421848001").createTime(dateTime1).build());
        list.add(ItemLabelDTO.builder().id(3L).label("210513170253289001").createTime(dateTime2).build());
        list.add(ItemLabelDTO.builder().id(4L).label("210513170355214001").createTime(dateTime3).build());
        return list;
    }

}
